package com.CST.controller;


import com.CST.annotation.*;
import com.CST.common.api.ResultObject;
import com.CST.common.constant.*;
import com.CST.dto.DateDTO;
import com.CST.entity.*;
import com.CST.service.*;
import com.CST.util.PageHelperTool;
import com.CST.vo.DepreciationDetailVO;
import io.swagger.annotations.*;

import java.util.*;

import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ly
 * @since 2022-04-22
 */
@Api(tags = {"折旧明细"})
@RestController
@RequestMapping("/etlDepreciationDetail")
public class EtlDepreciationDetailController {
    
    @Autowired
    private IEtlDepreciationDetailService etlDepreciationDetailService;
    
    @PostMapping("/listDepreciationByPDeptCode/{pDeptCode}")
    @ApiOperation("根据时间+父级科室代码获得 固定资产折旧 / 无形资产摊销 明细")
    public ResultObject listDepreciationByPDeptCode(@RequestBody DateDTO dateDTO, @PathVariable String pDeptCode){
        List<DepreciationDetailVO> list = etlDepreciationDetailService.listByPDeptCode(dateDTO, pDeptCode);
        return ResultObject.successReturn(list);
    }

    @PostMapping("/listDepreciationByPDeptCodeWithPage/{pDeptCode}/{pageNum}/{pageSize}")
    @ApiOperation("根据时间+父级科室代码获得 固定资产折旧 / 无形资产摊销 明细，带分页效果")
    public ResultObject listDepreciationByPDeptCodeWithPage(@RequestBody DateDTO dateDTO, @PathVariable String pDeptCode,
                                                            @PathVariable Integer pageNum, @PathVariable Integer pageSize){
        List<DepreciationDetailVO> list = etlDepreciationDetailService.listByPDeptCode(dateDTO, pDeptCode);
        return ResultObject.successReturn(PageHelperTool.excutePageInfo(list,pageNum,pageSize));
    }
    
    @PostMapping("/listDepreciationByDeptCode/{deptCode}")
    @ApiOperation("根据时间+科室代码获得 固定资产折旧 / 无形资产摊销 明细")
    public ResultObject listDepreciationByDeptCode(@RequestBody DateDTO dateDTO, @PathVariable String deptCode){
        List<DepreciationDetailVO> list = etlDepreciationDetailService.listByDeptCode(dateDTO, deptCode);
        return ResultObject.successReturn(list);
    }

}

